import request from "../utils/request";

// 获取验证码
export function getCodeImg(uuid) {
  return request({
    url: '/captcha/getCaptcha',
    method: 'get',
    params: {
      oldUuid: uuid
    },
    timeout: 20000
  })
  // return request.get('/captcha/getCaptcha')
}

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    url: '/user/login',
    method: 'post',
    data: data
  })
}


// 注册方法
export function register(data) {
  return request({
    url: '/user/register',
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo(username) {
  return request({
    url: '/user/getInfo',
    method: 'get',
    username: this.username
  })
}

// 退出方法
export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
